#include "clickbtn.h"


ClickBtn::ClickBtn(QWidget *parent):QPushButton(parent)
{
    setCursor(Qt::PointingHandCursor);
    setFocusPolicy(Qt::NoFocus);
}

ClickBtn::~ClickBtn()
{

}

void ClickBtn::SetState(QString normal, QString hover, QString press)
{
    _hover=hover;
    _normal=normal;
    _press=press;
    setProperty("state",_normal);
    repolish(this);
    update();
}

void ClickBtn::mouseReleaseEvent(QMouseEvent *e)
{
    setProperty("state",_hover);
    repolish(this);
    update();
    QPushButton::mouseReleaseEvent(e);
}

void ClickBtn::mousePressEvent(QMouseEvent *e)
{
    setProperty("state",_press);
    repolish(this);
    update();
    QPushButton::mousePressEvent(e);
}

void ClickBtn::enterEvent(QEvent *event)
{
    setProperty("state",_hover);
    repolish(this);
    update();
    QPushButton::enterEvent(event);
}

void ClickBtn::leaveEvent(QEvent *event)
{
    setProperty("state",_normal);
    repolish(this);
    update();
    QPushButton::leaveEvent(event);
}

